﻿using Business.PubInfo;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Jggk : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
           // labBgclass1.Text = labBgclass2.Text = Request["bname"];

       //     labBgclass3.Text = !string.IsNullOrEmpty(Request["sname"]) ? Request["sname"] : Request["bname"];
        }
    }

    public string GetLeftType()
    {
        PubInfoManage pimTemp = new PubInfoManage();
        DataTable dtSource = pimTemp.GetXlByBgClass(labBgclass1.Text);
        string strReturn = string.Empty;
        
        for (int i = 0; i < dtSource.Rows.Count; i++)
        {
            DataRow drTemp = dtSource.Rows[i];

            string strTempActive = "";
            if (!string.IsNullOrEmpty(Request["sname"]))
            {
                if (Request["sname"] == drTemp["pro_content"].ToString())
                {
                    strTempActive = "class='active'";
                }
            }
            else if (i == 0)
            {
                strTempActive = "class='active'";
            }
            strReturn += string.Format("<li {2}><a href='Jggk.aspx?bname={0}&sname={1}'>{1}</a></li>", labBgclass1.Text, drTemp["pro_content"], strTempActive);
        }
        return strReturn;
    }

    public string GetXlHtml()
    {
        string strXlx = string.Empty;
        if (!string.IsNullOrEmpty(Request["sname"]))
        {
            strXlx = Request["sname"];
        }

        PubInfoManage pimTemp = new PubInfoManage();
        DataTable dtSource = pimTemp.GetPubInfoList(0, labBgclass1.Text, strXlx, "");

        string strReturn = string.Empty;
        foreach (DataRow drTemp in dtSource.Rows)
        {
            strReturn += "<p><i></i>";
            strReturn += string.Format("<a href='Detail.aspx?lx={0}&art_id={1}' target='_blank'>{2}  </a><span>[{3}]</span>", drTemp["lx"], drTemp["id"], drTemp["bt"], Convert.ToDateTime(drTemp["tjrq"]).ToString("yyyy-MM-dd"));
            strReturn += " </p>";
        }
        //labRecordCount.Text = dtSource.Rows.Count.ToString();
        return strReturn;
    }
}